<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : manageProduct.xsl
    Created on : January 29, 2013, 12:57 PM
    Author     : NganNLK60334
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>
    <xsl:template match="/">
        <html>
            <body>
                
                <table>
                    <tr>
                        <th>productID</th>
                        <th>productName</th>
                        <th>price</th>
                        <th>productImg</th>
                        <th>description</th>
                        <th>Edit</th>
                        <th>Delete</th>
                        
                        
                    </tr>
                    <xsl:for-each select="products/product">
                        <form method ="POST" action="AdminController">
                        <tr>
                            <td>
                                <xsl:value-of select="productID"/>
                                <xsl:element name="input" >
                                        <xsl:attribute name="type">hidden</xsl:attribute>
                                        <xsl:attribute name="name">txtID</xsl:attribute>
                                        <xsl:attribute name="id">txtID<xsl:value-of select ='productID'/></xsl:attribute>
                                        <xsl:attribute name="value"><xsl:value-of select ='productID'/></xsl:attribute>
                                        <xsl:attribute name="readonly"></xsl:attribute>
                                        </xsl:element>
                            </td>

                            <td>
                                    <xsl:element name="input" required>
                                        <xsl:attribute name="type">text</xsl:attribute>
                                        <xsl:attribute name="name">txtName</xsl:attribute>
                                        <xsl:attribute name="id">txtName<xsl:value-of select ='productID'/></xsl:attribute>
                                        <xsl:attribute name="value"><xsl:value-of select ='productName'/></xsl:attribute>
                                        </xsl:element>
                            </td>

                          

                            <td>
                                
                                <xsl:element name="input">
                                        <xsl:attribute name="type">text</xsl:attribute>
                                        <xsl:attribute name="name">txtprice</xsl:attribute>
                                        <xsl:attribute name="id">txtprice<xsl:value-of select ='productID'/></xsl:attribute>
                                        <xsl:attribute name="value"><xsl:value-of select ='price'/></xsl:attribute>
                                        </xsl:element>
                            </td>
                            <td>
                                <img>
                                    <xsl:attribute name="src">Pictures/xmlImg/<xsl:value-of select = "productImg"/>
                                    </xsl:attribute>
                                </img>
                            </td>
                             <td>
                                 <xsl:element name="input">
                                        <xsl:attribute name="type">text</xsl:attribute>
                                        <xsl:attribute name="name">txtdescription</xsl:attribute>
                                         <xsl:attribute name="id">txtdescription<xsl:value-of select ='productID'/></xsl:attribute>
                                        <xsl:attribute name="value"><xsl:value-of select ='description'/></xsl:attribute>
                                        </xsl:element>
                            </td>
                           
                            <td>
                               <!-- <a href="AdminController?btnAction=editProduct">Lưu </a>-->
                                 <button class="save" type="submit" name="btnAction" value ="editProduct" onclick="return updateProduct({productID});">Lưu</button>
                            </td>

                            <td>
                               <!-- <a href="AdminController?btnAction=editProduct">Lưu </a>-->
                                 <button type="submit" name="btnAction" value ="deleteProduct">Xóa</button>
                            </td>
                            
                            
                        </tr>
                        </form>
                    </xsl:for-each>
                </table>
                
            </body>
        </html>
    </xsl:template>

</xsl:stylesheet>
